package com.itboye.app.mian.activity;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.config.GlobalConfig;
import com.itboye.core.alert.ByAlert;
import com.itboye.core.object.BaseActivity;
import com.itboye.core.object.SpPublicParams;
import com.itboye.core.utils.SPUtils;
import com.itboye.jmsfhz.R;
import com.itboye.jmsfhz.app.MainApplication;
import com.itboye.jmsfhz.app.logincontroller.LoginController;
import com.itboye.jmsfhz.app.logincontroller.UnLoginState;
import com.itboye.jmsfhz.app.ui.web.WebActivity;
import com.itboye.jmsfhz.main.WoMengFragment;

/**
 * @since 2016-05-10
 * @author liutiantian 关于萌屋
 * 
 */
public class AboutActivity extends BaseActivity {

	private TextView banben_num,user_text;
	private RelativeLayout realyoutAbout,realyoutxiyi;
	ImageView reback;
	Button btn_edtext; 

	@Override
	public int initView() {
		// TODO Auto-generated method stub 	
		return R.layout.about;
	}

	@Override
	public void onMyCreate() {
		// TODO Auto-generated method stub

		
		reback.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub Webview/Mix/user_agreement
				finish();
			}
		});
		realyoutAbout.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(AboutActivity.this,WebActivity.class);
				intent.putExtra( "url",GlobalConfig.WEBURL+"Webview/Mix/about");
				intent.putExtra("title","关于");
				startActivity(intent);
			}
		});
		realyoutxiyi.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(AboutActivity.this,WebActivity.class);
				
				intent.putExtra( "url",GlobalConfig.WEBURL+"Webview/Mix/user_agreement");
				intent.putExtra("title","用户协议");
				startActivity(intent);
			}
		});
		btn_edtext.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				SPUtils.put(AboutActivity.this, null, SpPublicParams.IS_LOGINED, false);
				LoginController.setLoginState(new UnLoginState());
				
				exit();
				finish();
			}
		});
	}
	private void exit() {
		// TODO Auto-generated method stub
		SPUtils.put(MainApplication.context, null, SpPublicParams.USER_NAME, "");
//		SPUtils.put(MainApplication.context, null, SpPublicParams.USERHEAD, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.NICK_NAME, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.UID, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.SEX, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.SIGNATURE, "");
		SPUtils.put(MainApplication.context, null, SpPublicParams.PHONE_MODEL,
				"");
		
		SPUtils.put(MainApplication.context, null, SpPublicParams.URL,
				"");
		
		SPUtils.put(MainApplication.context, null, SpPublicParams.IMAGE_URL,
				"");
		Intent intent=new Intent(WoMengFragment.AVARTACTION);
		sendBroadcast(intent);
		
		Intent start=new Intent("project");
		sendBroadcast(start);
	}

}
